<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>打印金字塔</title>
	</head>
	<body>
		
		<script>
		var a=prompt("请输入金字塔层数");
		document.write("<p align='center'</p>");
		
		for(var i=1;i<=a;i++){
			for(var j=1;j<=2*i-1;j++){
				document.write("*");
			}
		document.write("<br />");
		
		
	
	}
		</script>
	</body>
</html>
